package com.sth.springframework.beans.factory.support;

import com.sth.springframework.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: sitianhong
 * @Description:
 * @Since: create in 2021/8/27 0027 22:11
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    private Map<String, Object> singletonObjects = new HashMap<>();

    @Override
    public Object getSingleton(String beanName) {
        return singletonObjects.get(beanName);
    }

    protected void addSingleton(String beanName, Object object) {
        singletonObjects.put(beanName, object);
    }
}
